<head>
    <script src="../build/index.js"></script>
</head>

<body>
    <canvas id="app" width="400" height="800"></canvas>

    <script>
        var $app = new Easycanvas.Painter();

        Easycanvas.ImgLoader('https://raw.githubusercontent.com/c-zhuo/easycanvas/master/demos/G.png', function (img) {
            // create a Sprite
            window.Sprite1 = $app.add({
                name: 'root',
                content: {
                    img: img,
                },
                style: {
                    width: 250, height: 130,
                    cutLeft: 0, cutTop: 0, // source position, default 0
                    left: Easycanvas.Transition.pendulum(111, 222, 2500).loop(),
                    top: 80,
                    opacity: 1,
                    rotate: 20,
                    locate: 'center', // default center
                    zIndex: 1, // z-index of this image
                },
                hooks: {
                    ticked: function (t) {
                        if (!(t % 30)) {
                            console.log('每30个tick执行一次')
                        }
                    },
                },
            });

            $app.register(document.getElementById('app'));
            $app.start();

        });
    </script>
</body>

